# Copyright (c) 2019 Presto Labs Pte. Ltd.
# Author: donggu

import json

from experimental.prophet.graph import graph


def legacy_feature(proto_feed, feature_type, inner_config=None):
  if inner_config is None:
    inner_config = {}

  attrs = {
      'feature_type': feature_type,
      'inner_config': json.dumps(inner_config),
  }

  with graph.control_if(None):
    node = graph.create_node('fastfeed.LegacyFeature', [proto_feed], attrs=attrs).outputs
    return node
